<?php
use \yii\helpers\Url;
use \yii\helpers\Html;
use \common\models\Catalog;
use \common\models\Post;
use \common\models\Banner;
use \common\models\Links;
use yii\widgets\ListView;
use yii\bootstrap\BootstrapAsset;
use yii\web\JqueryAsset;
?><!--catalog-->
<!--/* @description 公司简介 */-->
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=Wb7ir4vAFvNmmNuCRMGTQ9kmmGhMhv1w"></script>
<script type="text/javascript" src="http://api.map.baidu.com/library/SearchInfoWindow/1.5/src/SearchInfoWindow_min.js"></script>
<link rel="stylesheet" href="http://api.map.baidu.com/library/SearchInfoWindow/1.5/src/SearchInfoWindow_min.css" />
<?php
$photos = Banner::photos('公司简介');
?>
<div  class="banner">
    <div class="hd">
        <ul>
            <?php if(count($photos)>1){?>
            <?php foreach ($photos as $photo){?>
                <li></li>
            <?php }?>
            <?php }?>
        </ul>
    </div>
    <div class="bd">
        <ul>
            <?php foreach ($photos as $photo){?>
                <li><a href="<?=$photo['url']?$photo['url']:'#'?>"><img src="<?=$photo['src']?>" /></a></li>
            <?php }?>
        </ul>
    </div>
    <a class="prev" href="javascript:void(0)"></a>
    <a class="next" href="javascript:void(0)"></a>
</div>
<script type="text/javascript">
    jQuery(".banner").slide({mainCell:".bd ul",autoPlay:true,effect:"fold",interTime:"2500"});
</script>
<!--<div class="online_box" style="top:748px;">-->
<!--    <img src="images/online.png">-->
<!--    <div>-->
<!--        <p><img src="images/online_contact.png"><span>科牌-小燕</span></p>-->
<!--        <p><img src="images/online_contact.png"><span>科牌-小燕</span></p>-->
<!--    </div>-->
<!--</div>-->
<div class="content wrapper" >

    <div class="content_box clearfix" style="padding-top: 50px;">
        <div class="company_info pull-right">
            <div class="pro_detail ">
                <div class="title clearfix">
                    <p class="pro_tit">公司概况</p>
                    <p>首 页  >  公司简介</p>
                </div>
            </div>
            <?=$article['content']?>
            <div class="map">
                <div id="allmap" ></div>

            </div>
        </div>
    </div>
</div>
<script>
    $(function () {
        var window_width=$(window).width();
        var count=0;
        var li_width=$(".banner .hd li").width()+16;
        $(".banner .hd li").each(function () {
            count++;
        });
//        $(".banner .hd ul").width(li_width*count);
//        window.onload = function(){
//            searchInfoWindow.open(marker);
//
//        };
        // 百度地图API功能
        var map = new BMap.Map('allmap');
        var poi = new BMap.Point(114.127242,22.684078);
        map.centerAndZoom(poi, 16);
        map.enableScrollWheelZoom();
        var content = '<div style="margin:0;line-height:20px;padding:2px;">' +
            '总部地址：<?=$conf['address']?><br/>'+
        '</div>';

        //创建检索信息窗口对象
        var searchInfoWindow = null;
        searchInfoWindow = new BMapLib.SearchInfoWindow(map, content, {
            title  : "<?=$conf['company']?>",      //标题
            width  : 290,             //宽度
            height :50,              //高度
            panel  : "panel",         //检索结果面板
            enableAutoPan : true,     //自动平移
            searchTypes   :[
                BMAPLIB_TAB_SEARCH,   //周边检索
                BMAPLIB_TAB_TO_HERE,  //到这里去
                BMAPLIB_TAB_FROM_HERE //从这里出发
            ]
        });
//        var marker = new BMap.Marker(poi); //创建marker对象
//        marker.enableDragging(); //marker可拖拽
//        marker.addEventListener("click", function(e){
//            searchInfoWindow.open(marker);
//        });
//        map.addOverlay(); //在地图中添加marker
        // 创建地址解析器实例
        var myGeo = new BMap.Geocoder();
        // 将地址解析结果显示在地图上,并调整地图视野
        myGeo.getPoint("<?=$conf['address']?>", function(point){
            if (point) {
                map.centerAndZoom(point, 16);
                var marker = new BMap.Marker(point); //创建marker对象
                marker.enableDragging(); //marker可拖拽
                marker.addEventListener("click", function(e){
                    searchInfoWindow.open(marker);
                });
                searchInfoWindow.open(marker);
                map.addOverlay(marker);
            }else{
                alert("您选择地址没有解析到结果!");
            }
        });
    });
</script>